package com.vote.www.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 汤伟杰 on 2017/5/16.
 */
@Service
public class DataresourceService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public Map<String,Object> getbycode(String code){
        List<Map<String, Object>> listmap = jdbcTemplate.queryForList("select * from czj_dataresource where code='" + code + "'");
        Map<String, Object> data = new HashMap<String, Object>();
        for (Map<String, Object> map : listmap) {
            data.put(String.valueOf(map.get("name")),map.get("value"));
        }
        return data;
    }
}
